<?php

class CategoryController extends AuthController{

private $db;
public function __init(){
  $this->db=new CategoryModel;


}

// 显示栏目列表
public function index(){
 $data=$this->db->getAll();
 $this->assign('data',$data);
 $this->display('index.html');

}

// 添加栏目
public function add(){
  if(IS_POST){
   	if($this->db->addCatagory($_POST)){
   		$this->success('添加栏目成功',__CONTROLLER__);
   	}else{
   		$this->error($this->db->error);
   	}

   }else{
   	$this->display('add.html');
   }
}
// 删除栏目
public function delete(){

   if(IS_POST){

    $this->db->deleteClass();
    $this->success('删除成功',__CONTROLLER__);

   }else{
    
    $this->error($this->db->error);
   }


  
}




}














?>